﻿using Luna小店.UC.销售记录.service;
using Luna小店.UC.门店下单.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Luna小店.UC.销售记录.model
{
    public class 销售记录Model
    {
        private List<OrderCommitDto> OrderCommitDtos = new List<OrderCommitDto>();
        private List<OrderCommitFacade> OrderCommitFacade = new List<OrderCommitFacade>();
        private List<SalesConfirmationEntryDTO> SalesConfirmationEntryDTOs = new List<SalesConfirmationEntryDTO>();

        /// <summary>
        /// 提交的dto的list
        /// </summary>
        /// <param name="OrderCommitDtos"></param>
        /// <returns></returns>
        public List<OrderCommitFacade> build提交List(List<OrderCommitDto> OrderCommitDtos)
        {
            foreach (OrderCommitDto OrderCommitDto in OrderCommitDtos)
            {
                this.OrderCommitFacade.Add(new OrderCommitFacade(OrderCommitDto, new SalesConfirmationEntryDTO(OrderCommitDto)));
            }
            return this.OrderCommitFacade;
        }
        /// <summary>
        /// 销售明细
        /// </summary>
        /// <param name="OrderCommitFacades"></param>
        /// <returns></returns>
        public List<SalesConfirmationEntryDTO> build销售明细(List<OrderCommitFacade> OrderCommitFacades)
        {
            foreach (OrderCommitFacade OrderCommitFacade in OrderCommitFacades)
            {
                this.SalesConfirmationEntryDTOs.Add(OrderCommitFacade.salesConfirmationEntryDTO);
            }
            return this.SalesConfirmationEntryDTOs;
        }
        
        /// <summary>
        /// 筛选orderDto字段装成新的dto
        /// </summary>
        /// <param name="orderDtos"></param>
        /// <returns></returns>
        public List<OrderCommitDto> build新OrderCommitDto(List<OrderDto> orderDtos)
        {
            foreach (OrderDto OrderDto in orderDtos)
            {
                this.OrderCommitDtos.Add(new OrderCommitDto(OrderDto));
            }
            return this.OrderCommitDtos;
        }
    }
}
